<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>清除浮动示例</title>
    <style>
        .container{
            background: crimson;
        }
        .float-item{
            width: 100px;
            height: 100px;
            float: left;
            background: aquamarine;
        }
        .clear-float:after{
          content: "";
          display: block;
          height: 0px;
          clear:both;
          visibility: hidden;
        }
    </style>
</head>
<body>
<div class="container clear-float">
    <div class="float-item"></div>
    <div class="float-item"></div>
</div>
</body>
</html>